// 初始化仓库
export const initState = {
    shopList: [],
    allFlag:false,
    price:0,
}

export const reducer = (state, action) => {
    switch (action.type) {
        case "changeShopList":
            return {
                ...state,
                shopList: action.arr
            }
        case "changeAllFlag":
            return {
                ...state,
                allFlag: action.flag
            }
        case "changePrice":
            return {
                ...state,
                price: action.price
            }
        default:
            return state
    }
}

export const actions = {
    changeShopList: (arr) => ({type: "changeShopList",arr}),
    changeAllFlag: (flag) => ({type: "changeAllFlag",flag}),
    changePrice: (price) => ({type: "changePrice",price}),
}